package com.bjpowernode.boss.web.service.impl;

import com.bjpowernode.boss.common.constants.KeyConstants;
import com.bjpowernode.boss.db.domain.DicPayType;
import com.bjpowernode.boss.web.models.dto.DicPayTypeDto;
import com.bjpowernode.boss.web.service.PayTypeService;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

import static com.bjpowernode.boss.PaymentApplication.CACHEMAP;

@Service
public class PayTypeServiceImpl implements PayTypeService {

    @Override
    public List<DicPayTypeDto> getPayTypeOptions(String wayCode) {
        List<DicPayTypeDto> dicPayTypeDtos = new ArrayList<>();
        List<DicPayTypeDto> list = (List<DicPayTypeDto>) CACHEMAP.get(KeyConstants.PAY_TYPE_OPTION);
        list.forEach(o -> {
            if(wayCode.equals(o.getPayWayCode())){
                dicPayTypeDtos.add(o);
            }
        });
        return dicPayTypeDtos;
    }
}
